package main

import "fmt"

type task struct {
	handler func() error
}

func NewTask(f func() error) *task {
	return &task{
		handler: f,
	}
}

type pool struct {
	EntryChan chan *task
	JobsChan  chan *task
	WorkNum   int8
}

func NewPool(workNum int8) *pool {
	return &pool{
		EntryChan: make(chan *task),
		JobsChan:  make(chan *task),
		WorkNum:   workNum,
	}
}

func (p pool) Worker(wid int) {
	for job := range p.JobsChan {
		job.handler()
		fmt.Println("worker", wid, "done")
	}
}

func (p pool) Run() {
	for i := 0; i < int(p.WorkNum); i++ {
		go p.Worker(i)

func main() {

}
